#include "wuButton.h"

wuButton::wuButton()
{
}

wuButton::~wuButton()
{
}

void wuButton::setRect(ofRectangle _rect)
{
	rect = _rect;
	cout << "button captured";
	active = false;
}

void wuButton::draw(bool bCambiazo)
{

	if(bSkin)
	{
		if(active && !bCambiazo)
			bgSkin.setColor(255,100,100, 255);	
		else
			bgSkin.setColor(255,255,255, 255);	

		wuBaseControl::bgSkin.draw();
	}
	else
	{
		if(active && !bCambiazo)
		{
			ofFill();
			ofEnableAlphaBlending();
			ofSetColor(255, 0, 0, 50);
			ofRect(rect.x, rect.y, rect.width, rect.height);
			ofDisableAlphaBlending();
		}
		else
			ofSetColor(255, 255, 255, 255);

	}
}

void wuButton::touch(vector <ofPoint> * _fingerList)
{
	active = false;

	for(int i=0; i< _fingerList->size(); i++)
	{
		if(rect.inside((*_fingerList)[i]))
			active = true;
	}
}

